package com.kamkor.interviewer.server;

import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.IdentityType;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;

import com.google.appengine.api.datastore.Text;

/**
 * Server side QuestionAnswer. It uses Text objects for question and answer.
 * 
 * Data Store sees String as short text. 
 *  
 * @author kamkor 
 */
@PersistenceCapable(identityType=IdentityType.APPLICATION)
public class QuestionAnswer {
	@PrimaryKey
	@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
	private Long id;
	
	/** QuestionAnswer position in interview. Starts with 0. */
	@Persistent
	private Long positionNumber; 
	
	@Persistent
	private Long interviewId;
	
	@Persistent
	private Text question;
	
	@Persistent
	private Text answer;
	
	public QuestionAnswer() { }
	
	public QuestionAnswer(Long interviewId, Text question, Text answer) {
		this.interviewId = interviewId;
		this.question = question;
		this.answer = answer;
	}
	
	public QuestionAnswer(Long id, Long interviewId, Text question, Text answer) {
		this(interviewId, question, answer);
		this.id = id;		
	}

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public Long getInterviewId() {
		return interviewId;
	}

	public void setInterviewId(Long interviewId) {
		this.interviewId = interviewId;
	}

	public Text getQuestion() {
		return question;
	}

	public void setQuestion(Text question) {
		this.question = question;
	}

	public Text getAnswer() {
		return answer;
	}

	public void setAnswer(Text answer) {
		this.answer = answer;
	}

	public void setPositionNumber(Long positionNumber) {
		this.positionNumber = positionNumber;
	}

	public Long getPositionNumber() {
		return positionNumber;
	}
}
